<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>天地图</title>
    <script src="http://api.tianditu.gov.cn/api?v=4.0&tk=95f0a5688ec713adb3dd1735533f6fcb"></script>
    <style type="text/css">body,html{width:100%;height:100%;margin:0;}#mapDiv{width:100%;height:100%;margin:0;}</style>
    <script>
        function getUrlPara(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
            var r = window.location.search.substr(1).match(reg);
            if (r!=null) return (r[2]); return null;
        }
        function onLoad() {
            //初始化地图对象
            var zoom = getUrlPara('zoom');
            var center = getUrlPara('center').split(',');
            var map = new T.Map("mapDiv");
            //设置显示地图的中心点和级别
            map.centerAndZoom(new T.LngLat(center[0], center[1]), zoom);
            var scale = new T.Control.Scale();
            map.addControl(scale);
        }
    </script>
</head>
<body onLoad="onLoad()">
<div id="mapDiv"></div>
</body>
</html>
